﻿using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using AutoMapper;
using good1.ApplicationServices.Interface;
using good1.Core;
using good1.Web.Controllers.Filters;
using good1.Web.Controllers.Infrastructure;
using good1.Web.Controllers.Infrastructure.Cookies;
using good1.Web.Model;
using SharpArch.Core;

namespace good1.Web.Controllers
{

    public class AboutController : BaseController
    {
        private AboutView aboutView;

        public AboutController(ICharityService charityService, ISecurityContextService securityContext): base(securityContext)
        {
            Check.Require(charityService != null, "charityService may not be null");
            this.charityService = charityService;
            
            aboutView = CreateViewData<AboutView>();
        }

        public ActionResult Index()
        {
            return View(aboutView);
        }

        public ActionResult Team()
        {
            return View(aboutView);
        }


        [CompressFilter]
        [CacheFilter(DurationInDays = 1)]
        public ActionResult Charities()
        {
            IList<Charity> charityList = charityService.GetAllSorted();
            CharityListView charityListView = CreateViewData<CharityListView>();

            Mapper.CreateMap<Charity, CharityView>();
            charityListView.CharityList = Mapper.Map<IList<Charity>, IList<CharityView>>(charityList);
      
            return View(charityListView);
        }

        public ActionResult Panel()
        {
            return View(aboutView);
        }

        public ActionResult How()
        {

            return View(aboutView);
        }

        public ActionResult People()
        {
            return View(aboutView);
        }


        public ActionResult Volunteers()
        {
            return View(aboutView);
        }


        public ActionResult News()
        {
            return View(aboutView);
        }


        private readonly ICharityService charityService;
    }
}
